KEXEC: fix kexec_get_range_compat to fail vocally.
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 5 Dec 2011 19:42:46 +0000 (19:42 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 5 Dec 2011 19:42:46 +0000 (19:42 +0000)
Fail with -ERANGE rather than silently truncating 64bit values (a
physical address and size) into 32bit integers for dom0 to consume.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Simplify the bitwise arithmetic a bit.

Signed-off-by: Keir Fraser <keir@xen.org>
xen/common/kexec.c

index 1a3b52382dfecec46958394b087ea1a4b08bd8f8..e520348736646918bfb5b5476cf4facb36f1d82f 100644 (file)
@@ -395,6 +395,10 @@ static int kexec_get_range_compat(XEN_GUEST_HANDLE(void) uarg)
 
     ret = kexec_get_range_internal(&range);
 
+    /* Dont silently truncate physical addresses or sizes. */
+    if ( (range.start | range.size) & ~(unsigned long)(~0u) )
+        return -ERANGE;
+
     if ( ret == 0 ) {
         XLAT_kexec_range(&compat_range, &range);
         if ( unlikely(copy_to_guest(uarg, &compat_range, 1)) )